<template>
	<view :style="themeColor">
		<template>
			<view class="week-container">
				<view v-for="(day, index) in weekDays" :key="index" class="day" @click="selectDay(day)"
					:class="{'selected-day': selectedDay && selectedDay.rawDate.getTime() == day.rawDate.getTime()}">
					<view>{{ day.label }}</view>
					<view>{{ day.date }}</view>
				</view>
			</view>
		</template>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				selectedDay: null,
				weekDays: []
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {

		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			getWeekDays() {
				const today = new Date();
				const weekDays = Array.from({
					length: 7
				}).map((_, i) => {
					let tempDate = new Date(today);
					tempDate.setDate(today.getDate() + i);
					return {
						date: `${tempDate.getMonth() + 1}-${tempDate.getDate()}`,
						label: `周${'日一二三四五六'[tempDate.getDay()]}`,
						rawDate: tempDate
					};
				});
				this.weekDays = weekDays;
			},
			selectDay(day) {
				this.selectedDay = day;
				console.log(this.selectedDay, '选择的日期');
				// 这里可以继续添加更多的逻辑，比如发送请求等。
			}
		},
		created() {
			this.getWeekDays();
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #fff;
		background-size: 100% auto !important;
	}

	.week-container {
		display: flex;
		justify-content: space-between;
	}

	.day {
		text-align: center;
		padding: 10px;
		border: 1px solid #ccc;
		border-radius: 5px;
	}

	.selected-day {
		background-color: #007BFF;
		/* Bootstrap 蓝色 */
		color: white;
	}

	.day.active {
		border-color: #fff;
	}

	.wentiInfo_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.wentiInfo_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: var(--benbenFontColor0);
	}

	.wentiInfo_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
	}

	.wentiInfo_fd0_0_c0 {
		width: 180rpx;
	}

	.wentiInfo_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.ben_fu-jyf-parser_1 {
		background-color: #fff;
		padding-left: 32rpx;
		padding-right: 32rpx;
		padding-top: 32rpx;
		padding-bottom: 32rpx;

	}
</style>